home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 255_01 / gpmovmtg.asm < prev    next >
Assembly Source File  |  1988-03-28  |  3KB  |  103 lines

  1.           page   80,132
  2.           page
  3.  
  4.           title  'Enhance Graphic Adapter Function: WTPIXELS()'
  5.  
  6. ;   Initialize graphic software for 640x350 color/mono graphics.
  7. ;
  8. ;         Kent Cedola
  9. ;         2015 Meadow Lake Ct.
  10. ;         Norfolk, Virginia  23518
  11. ;
  12.  
  13. dgroup    group  _data
  14.  
  15. _data     segment word public 'data'
  16.           assume ds:dgroup
  17.  
  18.           extrn  _gdcur_x:word,_gdcur_y:word
  19.  
  20. _data     ends
  21.  
  22. _text     SEGMENT BYTE PUBLIC 'CODE'
  23.           assume cs:_text,ds:dgroup
  24.  
  25.           public _gpmovmtg
  26.  
  27. _gpmovmtg proc   near
  28.  
  29.           push   bp
  30.           mov    bp,sp
  31.           push   si
  32.           push   di
  33.  
  34.           mov    dx,03CEh
  35.           mov    ax,0205h
  36.           out    dx,ax
  37.           mov    al,8
  38.           out    dx,al
  39.           inc    dx
  40.  
  41.           mov    ax,_gdcur_y
  42.           shl    ax,1
  43.           shl    ax,1
  44.           add    ax,_gdcur_y
  45.           add    ax,0A000h
  46.           mov    es,ax
  47.  
  48.           mov    cx,_gdcur_x           ; Copy X coordinate to a work register
  49.           MOV    di,cx                 ; Copy X corrdinate
  50.           SHR    DI,1                  ; Divide X corrdinate by three and
  51.           SHR    DI,1                  ;   ...
  52.           SHR    DI,1                  ;   ...
  53.  
  54.           MOV    AL,80h                ; Determine the starting bit to plot
  55.           AND    CL,7                  ;   ...
  56.           ROR    AL,CL                 ;   ...
  57.  
  58.           mov    si,[bp+4]
  59.           mov    cx,[bp+6]
  60.           mov    bx,[bp+8]
  61. nextrow:
  62.           push   di
  63.           push   si
  64.           push   cx
  65.           push   ax
  66. nextbit:
  67.           OUT    DX,AL                 ; Set mask bit
  68.           MOV    AH,ES:[DI]            ; Read graphic byte into latches
  69.           mov    ah,[si]
  70.           inc    si
  71.           MOV    ES:[DI],AH            ; Apply merge function to bit and store
  72.           ror    al,1
  73.           adc    di,0
  74.           loop   nextbit
  75.  
  76.           pop    ax
  77.           pop    cx
  78.           pop    si
  79.           pop    di
  80.  
  81.           add    si,[bp+10]
  82.           add    di,80
  83.           dec    bx
  84.           jnz    nextrow
  85.  
  86.           mov    al,0FFh
  87.           out    dx,al
  88.           dec    dx
  89.           mov    ax,5
  90.           out    dx,ax
  91.           mov    al,3
  92.           out    dx,ax
  93.  
  94.           pop    di
  95.           pop    si
  96.           pop    bp
  97.           ret                          ; Return to caller
  98.  
  99. _gpmovmtg endp
  100.  
  101. _text     ends
  102.           end
  103.